package com.joven.security.service.impl;

import com.alibaba.fastjson.JSON;
import com.joven.security.dao.SysMenuDao;
import com.joven.security.model.SysMenu;
import com.joven.security.service.MenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author wzj
 * @Date 2023-03-01 15:45
 **/
@Slf4j
@Service
public class MenuServiceImpl implements MenuService {

    @Resource
    private SysMenuDao sysMenuDao;

    @Override
    @PostFilter("filterObject.status.equals('0')")
    public List<SysMenu> queryAllMenus() {
        List<SysMenu> sysMenus = sysMenuDao.selectAll();
        log.info("sysMenus:{}", JSON.toJSONString(sysMenus));
        return sysMenus;
    }
}
